home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 7805 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.0 KB

  1. Path: solon.com!not-for-mail
  2. From: Gerald Feldman <gaf@zk3.dec.com>
  3. Newsgroups: comp.lang.c.moderated,comp.lang.c
  4. Subject: Re: Test for infinity?
  5. Date: 28 Feb 1996 18:55:30 -0600
  6. Organization: Digital Unix Development Environment
  7. Sender: clc@solutions.solon.com
  8. Approved: clc@solutions.solon.com
  9. Message-ID: <4h2ti2$1jc@solutions.solon.com>
  10. References: <4gfci8$2jd@solutions.solon.com>
  11. NNTP-Posting-Host: solutions.solon.com
  12. X-Mailer: Mozilla 2.0 (X11; I; OSF1 T4.0 alpha)
  13.  
  14. John J. Har wrote:
  15. > Is there any ANSI function or code snippet that would test a double for
  16. > (positive) infinity? For that matter, how about for denormals and NaN's?
  17. > Please send responses (or copies of posts) to me by email, since I don't
  18. > check these newsgroups frequently.
  19. John,
  20. As I mentioned in a previous email, I would send something to you.
  21. NaNs, Infinities, and denormals are not included as part of the C
  22. standard. They are covered by other standards, such as IEEE and XPG4
  23. (Unix). IEEE only requires certain properties, such as NaN, Infinity,
  24. and denormals. XPG4 defines the isnan() function, which reports non-zero
  25. when its argument is a NaN. IEEE 754-1985 does recommend function
  26. class(). Digital Unix implements that as fp_class. This function returns 
  27.   Constant          Class
  28.   _____________________________________________________
  29.   FP_SNAN           Signaling NaN (Not-a-Number)
  30.   FP_QNAN           Quiet NaN (Not-a-Number)
  31.   FP_POS_INF        +infinity
  32.   FP_NEG_INF        -infinity
  33.   FP_POS_NORM       Positive normalized
  34.   FP_NEG_NORM       Negative normalized
  35.   FP_POS_DENORM     Positive denormalized
  36.   FP_NEG_DENORM     Negative denormalized
  37.   FP_POS_ZERO       +0.0 (positive zero)
  38.   FP_NEG_ZERO       -0.0 (negative zero)
  39.  
  40. There is also an IEEE finite() function. 
  41.  
  42. Those systems supporting IEEE functionality should have all of these
  43. functions available, though posssibly in some different forms. 
  44.   
  45. -- 
  46. Jerry Feldman              Digital Unix Development Environment
  47. Digital Equipment Corp.    Nashua, NH 03062-9987      
  48. gaf@zk3.dec.com, gaf@bcs.org
  49.